// pages/mylove
const App = getApp();
Page({
  data:{
    length:'',
    "items": [
      {
        "picId": 5,
        "wordId": "云",
        "picType": 3,
        "imgUrl": "https://www.yunmosf.top/storage/dictionary/single/ancient/yun.png",
        "userId": 2,
        "name": "不期望&不失望",
        "checkStatus": 1
      },
      {
        "picId": 5,
        "wordId": "墨",
        "picType": 3,
        "imgUrl": "https://www.yunmosf.top/storage/dictionary/single/ancient/mo.png",
        "userId": 2,
        "name": "不期望&不失望",
        "checkStatus": 1
      },
      {
        "picId": 5,
        "wordId": "书",
        "picType": 3,
        "imgUrl": "https://www.yunmosf.top/storage/dictionary/single/ancient/shu.png",
        "userId": 2,
        "name": "不期望&不失望",
        "checkStatus": 1
      },
      {
        "picId": 5,
        "wordId": "法",
        "picType": 3,
        "imgUrl": "https://www.yunmosf.top/storage/dictionary/single/ancient/fa.png",
        "userId": 2,
        "name": "不期望&不失望",
        "checkStatus": 1
      },
      {
        "picId": 5,
        "wordId": "勇",
        "picType": 3,
        "imgUrl": "../../images/user/yong.png",
        "userId": 2,
        "name": "不期望&不失望",
        "checkStatus": 0
      }
    
    ]

  },
  clickImg:function(e){
    console.log(e);
    let _this=this;
    // 下面这个玩意，就是获取当下的src，然后下面那个urls是个数组，用于储存所有urls。current是当下的url
    let src=e.currentTarget.dataset.src;
    wx.previewImage({
      urls: [src],
      complete: (res) => {},
      current: 'src',
      fail: (res) => {},
      success: (res) => {},
    })
  },

  onReady:function(){
    // 页面渲染完成
  },
  onShow:function(){
    let _this=this;
    App._get('/user_center/my_word',{openId:wx.getStorageSync('openId')},result=>{
      //0.0这个result你是不是处理成直接获取data.data里面的了
      let length=result.length;
      _this.setData({
        items: result,
        length:length
      })

    })
  },
  onHide:function(){
    // 页面隐藏
  },
  onUnload:function(){
    // 页面关闭
  }
})
